using System;
using System.IO;
using System.Xml;
using System.Xml.Xsl;

public class Transform {
    private readonly String xmlFile;
    private readonly String areaFile;

    public Transform(String xml, String area) {
        xmlFile = xml;
        areaFile = area;
    }

    public void createArea() {
        XmlDocument xmlDoc = new XmlDocument();
        XslCompiledTransform xslTran = new XslCompiledTransform();
        xmlDoc.PreserveWhitespace = true;
        StreamWriter writer = File.CreateText(areaFile);

        xmlDoc.Load(xmlFile);
        
        xslTran.Load(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "XMLtoROM.xsl"));

        xslTran.Transform(new XmlNodeReader(xmlDoc), null, writer);
        writer.Close();
    }
}